package com.example.campus.dao.table_gateway;


import com.example.campus.dao.model.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Table gateway for Course pojo
 */
@Mapper
public interface CourseMapper {

    @Select("select * from t_course")
    List<Course> allCourses();

    @Select("select * from t_course where id = #{id}")
    Course courseById(@Param("id") long id);


    @Insert("insert into t_course (course_name, created_time) VAlUES (#{courseName}, #{createdTime})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void addCourse(Course course);
}
